<%@ page language="java" contentType="text/html; charset=UTF-8"	 pageEncoding="UTF-8"%>
<%@ include file="../include/laypublic.jsp"%>
<!DOCTYPE html>
<html>
<head>
  <title>已发短信查询</title>
</head>
<body>
  <div class="layui-fluid">   
    <div class="layui-card">
      <!-- 查询区域  -->
      <div id="query-form" class="layui-form layui-card-header layuiadmin-card-header-auto">
        <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">收件人</label>
            <div class="layui-input-inline">
              <input type="text" name="msgRecipient" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">内容</label>
            <div class="layui-input-inline">
              <input type="text" name="content" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
          </div>
          <div class="layui-inline">
            <label class="layui-form-label">发送状态</label>
            <div class="layui-input-inline">
            	<infopub:select entireName="-发送状态" id="istate" name="state" type="dic" groupNo="A00010015">
				</infopub:select>
            </div>
          </div>
          <div>
          <div class="layui-inline">
             <label class="layui-form-label">发送时间</label>
             <div class="layui-input-inline">
               <input type="text" class="layui-input" id="sent-laydate-start" readonly name="startDate" placeholder="开始日期">
             </div>
             <div class="layui-form-mid">
               -
             </div>
             <div class="layui-input-inline">
               <input type="text" class="layui-input" id="sent-laydate-end" readonly name="endDate" placeholder="结束日期">
             </div>
           </div>
          <shiro:hasPermission name="QUERY_MSG_MESSAGE">
	          <div class="layui-inline">
	            <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="LAY-task-message-search">
	              <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>查询
	            </button>
	            <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="LAY-user-back-reset">
	              <i class="layui-icon layui-icon-fonts-clear  layuiadmin-button-btn"></i>重置
	            </button>
	          </div>
          </shiro:hasPermission>
        </div>
      </div>
      <div class="layui-card-body">
      	<!-- 数据表单 -->
        <table id="LAY-task-message-manage" lay-filter="LAY-task-message-manage"></table>
      </div>
    </div>
  </div>

  <script>
  //json
  var istateJSON = <infopub:dicJson groupNo="A00010015" />;
  layui.config({
    base: '${ctx}/resources/layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'table', 'laydate'], function(){
    var $ = layui.$
    ,form = layui.form
    ,table = layui.table
    ,laydate = layui.laydate;
    
    //示例代码
    
    //开始日期
    var insStart = laydate.render({
      elem: '#sent-laydate-start'
      ,done: function(value, date){
        //更新结束日期的最小日期
        insEnd.config.min = lay.extend({}, date, {
          month: date.month - 1
        });
        
        //自动弹出结束日期的选择器
       insEnd.config.elem[0].focus();
      }
    });
    
    //结束日期
    var insEnd = laydate.render({
      elem: '#sent-laydate-end'
      ,done: function(value, date){
        //更新开始日期的最大日期
        insStart.config.max = lay.extend({}, date, {
          month: date.month - 1
        });
      }
    });
    // 表单
    table.render({
      elem: '#LAY-task-message-manage'
      ,url: basePath + '/msgTask/message/query' //请求数据接口
      ,cols: [[
        {type: 'checkbox', fixed: 'left'}
        ,{field: 'title', title: '标题'}
        ,{field: 'msgRecipient', title: '收件人'}
        ,{field: 'content', title: '内容'}
        ,{field: 'state', title: '发送状态', templet: function(d){
    		  return istateJSON[d.state];
    		}
        }
        ,{field: 'addtime', title: '创建时间', templet: function(d){
      		  return layui.util.toDateString(d.addtime,"yyyy-MM-dd HH:mm:ss");
        	}
        }
        ,{field: 'beginSendDatetime', title: '发送时间', templet: function(d){
        	 return layui.util.toDateString(d.beginSendDatetime,"yyyy-MM-dd HH:mm:ss");
	       }
	    }
        ,{field: 'senderTemplateName', title: '消息模板名称'}
        ,{field: 'partnername', title: '消息供应商'}
        ,{field: 'msgDesc', title: '描述', templet: function(d){
        		return d.msgDesc||global_null_tip;
        	}
        }
      ]]
      ,page: true
      ,limit: 10
    });
    
    <shiro:hasPermission name="QUERY_MSG_MESSAGE">
	    //监听搜索
	    form.on('submit(LAY-task-message-search)', function(data){
	      //执行重载
	      table.reload('LAY-task-message-manage', {page: {curr: 1},
	        where: trimData(data)
	      });
	    });
	  	//重置清空
	    form.on('submit(LAY-user-back-reset)', function(data){
	    	reset_form('query-form');
	    	//额外处理select
			$("#istate").val('');
	    });
    </shiro:hasPermission>
  });
  </script>
</body>
</html>

